package com.platform.service.impl;

import com.platform.dao.IncomeCoinDao;
import com.platform.entity.IncomeCoinEntity;
import com.platform.service.IncomeCoinService;
import com.platform.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 运动币记录表Service实现类
 *
 * @author lipengjun
 * @email 939961241@qq.com
 * @date 2019-02-20 19:49:17
 */
@Service("incomeCoinService")
public class IncomeCoinServiceImpl implements IncomeCoinService {
    @Autowired
    private IncomeCoinDao incomeCoinDao;

    @Override
    public IncomeCoinEntity queryObject(Long id) {
        return incomeCoinDao.queryObject(id);
    }

    @Override
    public List<IncomeCoinEntity> queryList(Map<String, Object> map) {
        return incomeCoinDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return incomeCoinDao.queryTotal(map);
    }

    @Override
    public int save(IncomeCoinEntity tIncomeCoin) {
        return incomeCoinDao.save(tIncomeCoin);
    }

    @Override
    public int update(IncomeCoinEntity tIncomeCoin) {
        return incomeCoinDao.update(tIncomeCoin);
    }

    @Override
    public int delete(Long id) {
        return incomeCoinDao.delete(id);
    }

    @Override
    public int deleteBatch(Long[] ids) {
        return incomeCoinDao.deleteBatch(ids);
    }

    @Override
    public BigDecimal totalDetail(int key) {
        return incomeCoinDao.totalDetail(key);
    }

    @Override
    public BigDecimal queryCoins(Map<String, Object> map) {
        return incomeCoinDao.queryCoins(map);
    }
    @Override
    public BigDecimal queryMining(Map<String, Object> map) {
        String today = DateUtils.format(new Date());
        Date tomorrow = DateUtils.minusDateForDay(today, 1);
        map.put("today", today);
        map.put("tomorrow",tomorrow);
        return incomeCoinDao.queryMining(map);
    }
}
